package Demo;

public class Demo10 {
    public static void main(String[] args) {
        // 三目运算符 表达式（结果为布尔类型）？值1：值2
        int a =20;
        int b = 30;
        int c = a > b ? a : b;
        System.out.println(c);

        //判断三个数的最大值
        int x =100;
        int y = 200;
        int z =300;

        int a1 = x > y ? x : y;
        int a2 = z >a1? z : a1;
        System.out.println(a2);

        int a3 = (x > y ? x :y) > z ? (x > y ? x :y) : z;
        System.out.println(a3);
    }
}
